Skip to content

Fix external-file ImageSeries test and require pynwb>=4.0 - #708

Merged
rly merged 4 commits into
devfrom
fix/image-series-num-samples-pynwb-4
Jun 30, 2026
Merged

Fix external-file ImageSeries test and require pynwb>=4.0#708
rly merged 4 commits into
devfrom
fix/image-series-num-samples-pynwb-4

Conversation

@rly

@rly rly commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #707.

Problem

After PyNWB 4.0.0 was released, the daily and dev CI workflows started failing on tests/unit_tests/test_image_series.py::TestExternalFileValid::test_check_image_series_external_file_valid_bytestring_pass:

ValueError: ImageSeries 'TestImageSeries': num_samples should be set when format='external'
and rate is used for timing, because data is empty and its length cannot be used to determine
the number of frames.

PyNWB 4.0.0 added validation that an ImageSeries with format='external' and rate timing must set num_samples, since the frame count cannot be inferred from the (empty) data length. The test constructs exactly such an ImageSeries without num_samples, so it now raises at construction time.

#707 ran against PyNWB 3.1.3 (PyNWB 4.0.0 had not yet been released), so it did not surface this. The scheduled runs picked up 4.0.0 once it was published.

Changes

  • Pass num_samples=1 when constructing the ImageSeries in that test, satisfying the PyNWB 4.0.0 validation.
  • Raise the minimum PyNWB to >=4.0 in pyproject.toml. NWB Inspector targets the latest PyNWB only (see Support only latest PyNWB #510), and the latest release is now 4.0.0, so the floor is bumped to match.

Scope

The test is the only place in the suite combining format="external" with rate timing and empty data. Other external-file constructions use timestamps, which derive the frame count and do not trip the new check.

Note: the test-dandi-dev / test-dandi-dev-live jobs fail with the same ValueError raised from DANDI's own test fixtures (dandi/tests/fixtures.py), which is an upstream DANDI incompatibility with PyNWB 4.0 and is not addressed here.

🤖 Generated with Claude Code

rly and others added 2 commits June 30, 2026 12:29
PyNWB 4.0.0 raises a ValueError when an ImageSeries with format='external'
uses rate for timing and has empty data, unless num_samples is set, because
the frame count can no longer be inferred from the data length. Pass
num_samples=1 so test_check_image_series_external_file_valid_bytestring_pass
constructs successfully.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
NWB Inspector tracks the latest PyNWB only (#510). The latest release is
4.0.0, so raise the minimum to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rly rly changed the title Set num_samples in external-file ImageSeries test for PyNWB 4.0 Fix external-file ImageSeries test and require pynwb>=4.0 Jun 30, 2026
@rly
rly requested a review from bendichter June 30, 2026 19:34
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rly
rly enabled auto-merge (squash) June 30, 2026 19:36
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.81%. Comparing base (13d0d67) to head (7c57e8a).
⚠️ Report is 5 commits behind head on dev.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #708      +/-   ##
==========================================
+ Coverage   79.44%   82.81%   +3.37%     
==========================================
  Files          48       48              
  Lines        1897     1897              
==========================================
+ Hits         1507     1571      +64     
+ Misses        390      326      -64     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rly
rly merged commit 95d62d6 into dev Jun 30, 2026
25 checks passed
@rly
rly deleted the fix/image-series-num-samples-pynwb-4 branch June 30, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants